oops.. used abs instead of fabs from math library