Fixed bug in modulus calc, and added unit tests for maths class