Refactor modal controller for linting errors