Re-factored some of the tile logic to make sure state is preserved