Math classes cleaned and improved for better interoperability.