refactored search controller

fixes #42