Refactored categories_controller into successful/failed callbacks.