Converted maths methods to use dataset factory
Added back necessary code