refactor process(input)