Cleanups:
* Prefer references over pointers
* Use auto when it makes sense