Use pointer instead of reference members in some classes.

This allows objects of those classes to be copied.