update search controller to further seperate and improve logic