division by zero protection
Doing the knuth shuffel