pull byval processing out to its own helper function.