Replace xrange, refs #38
Merge branch 'master' into issue38_11