Fixed some queries, testing still needed