Moved functions to search controller