Revised following review.

Mainly synthetic changes, apart from to add the support of primitive parameters as candidates for parameter resolution.