Abstracted input handling into a controller class.