Replaced some pointer arguments to references.