Changed the handling of (de)selection of positionable tags to a more general way. Also did some code cleanup.