This kind of works: the problem now is that the sides go from 0 - max-1 instead of 1-max.