Added more routing options

Generic query building according to xml