Porting to run on python3