Found out why board didn't work for powers of two, fixed.