Extracted Tile direction attribute into a function to save resources