Added various optimizations for tilemaps