improve controller input logic