Finished advancedSearch logic. Needs more testing potentially