Changed from range to xrange, so it's more efficient, hopefully