Refactored controllers and updated tests.