Split out pure mathematical functions into own package