changed to xrange and added benchmark test