Updated code to python 3.0