Put constants at top. Off-by-one error in cols and rows constraint.