Added logic to check if tile exists, increased tile write speed