drop unnecessary query switch, simplify xpath node selection (will change this), added some comments