Clean up code a bit, putting some things into functions for clarity.
(#304)
Update shear_reference test
(#304)
Update commit for shearfield_ref.py
(#304)