refactor some of the input functions