Refactoring controller to use functional obj construction