Added queryToTable function to dbw class