Fix division through 0 and remove some testing code