Refactoring of tests and searches controller