Refactoring controllers to atomic functions.