Added basic support for tiled map format; several fixes and changes