Moved the input functionality to a seperate class.