Refactor to allow testing of parameter resolving.