Refactor: split the controller