moved stuff into controller

Controller separate from search