Fixed conversion from 2D points to 1D for drawing (i hope)