refactor input controls