Moved setting of variables to 0 above if statements

Seems to be working fine now!