System.out.println(ret.toString());
logger.debug(ret.toString());
    private Map readMPHDChunk(InputStream in) throws IOException {        Map ret = null;        TileSet set = new TileSet();        int major, minor;        major = in.read();        minor = in.read();        in.skip(2); // skip lsb and reserved bytes - always msb        ret = new Map(Util.readShort(in), Util.readShort(in));        Properties retProps = ret.getProperties();        ret.setOrientation(Map.MDO_ORTHO);        //be sure to set the orientation!        retProps.setProperty("(s)fmap reader", "Don't modify properties marked (s) unless you really know what you're doing.");        retProps.setProperty("version", "" + major + "." + minor);        in.skip(4); // reserved        twidth = Util.readShort(in);        theight = Util.readShort(in);        ret.setTileWidth(twidth);        ret.setTileHeight(theight);        set.setName("Static tiles");        ret.addTileset(set);        int depth = Util.readShort(in);        if (depth < 16) {            throw new                IOException("Tile bitdepths less than 16 are not supported!");        }        retProps.setProperty("(s)depth", String.valueOf(depth));        in.skip(2);        int numBlocks = Util.readShort(in);        int numBlocksGfx = Util.readShort(in);        Chunk c = findChunk("BKDT");        if(c == null) {            throw new IOException("No BKDT block found!");        }        MapLayer ml = new TileLayer(ret, ret.getWidth(),ret.getHeight());        ml.setName("bg");        ret.addLayer(ml);        for(int i=1;i<7;i++) {            //TODO: I believe this should be ObjectGroup            ml = new ObjectGroup(ret, 0, 0);            ml.setName("ObjectLayer " + i);            ret.addLayer(ml);        }        ml = new TileLayer(ret, ret.getWidth(),ret.getHeight());        ml.setName("fg 1");        ret.addLayer(ml);        ml = new TileLayer(ret, ret.getWidth(),ret.getHeight());        ml.setName("fg 2");        ret.addLayer(ml);        ml = new TileLayer(ret, ret.getWidth(),ret.getHeight());        ml.setName("fg 3");        ret.addLayer(ml);        readBKDTChunk(ret, c.getInputStream(), numBlocks);        c = findChunk("BGFX");        if(c != null) {            readBGFXChunk(ret, c.getInputStream(), numBlocksGfx);        }else{            throw new IOException("No BGFX chunk found!");        }        System.out.println(ret.toString());        return ret;    }