Re-factor and code clean up for tilemaps.