Added javadocs and fixed tile engine