converted the rest of the queries, fixed some more bugs