Math stuff

Fixed a few mathematical errors (I think). One question, why are there
pointers in the if statements and no condition? What is done or checked?