Updated to Python 3

Updated file to work with Python 3. Also added some explanatory
comments. Due to formating of print statements, loss of compatibility
with Python 2.7.*