Corrections and succinctness changes to math.cpp