Added db query builder (closes #101)