Updates search functionality with support of search options. Refactoring, commenting, cleanup