finish moving queries to db file