Changed query call to call mainquery instead of just quepy
Fixed merge