Added correct selection code for TM/HM view.