moved xrange

Need to define it BEFORE I use it