generalized the math package