xrange instead of while-loop