flesh out coordinate system and fix bug in quaternion