Moving API call logic to controller, adding search action