Tile marking fix

Reorganized the tile marking code so that it works properly when a user
clicks a marked tile in Mark mode.