We should range rather than xrange here for Python 3 compatibility.