Refactored and created querybuilder, a bit nicer now