Switch to references
Switch almost(?) all class pointer inputs to references, instead.  It seems that references have some benefits over pointers in C++, so let's take advantage of that.
Note: this change ends up requiring more memory in some places, since we can't pass NULL as a reference, so we create temporary variables that just get created and destroyed.