make functions that process input unit-testable