refactor controller.ls