Py3 fix
reformat and clean up some old code