Re-jiggered, re-sorted

Put the reference frame and transform math stuff in its own place. More
to come.