Move input related stuff to Input class, fix a typo from last commit.