first attempt at porting to python 3