some refactoring of the input