Ran 2to3 to convert to python 3.x
Merged changes to tools.py to work with python 3.x