Changed range to xrange.