Finished refactoring. Heavy testing coming soon + code for disjunctive queries