Tidy up markSelected method

Includes fix for misplaced comma.