change range to xrange for huge iterations