Moved query & completion logic from MainController to new AjaxController + added routes.