Fixed a lot of queries

Think I fixed the remaining queries.