inlined commonly used processInput()