Improve controller method code