replace xrange with range function