Refactored code to use explicit controllers