Refactored Tile.js