got rid of last xrange -> range error.  Python 3 is driving me mad.