Changed pi to that defined in <math.h>