Improve controller UI code