Search functionality optimized

Search conditionals updated a long with bug fixes