Avoided reassignment of parameters in four places.

Introduced variables so that parameters are not reassigned.