change range to xrange, memory