Reworking the way queries are built up
merged stashed work
Heavy rework of the queries - see issue #55