Renamed AJAX action.
Moved some function to the view.