initial math commit; some restructuring