Fixed unnecessary garbage creation. Added flexible map size and map generation from JSON.