Replace xrange() with range() (xrange no longer applicable in python3)