database stuff - start working on query builder