Finished Python 3 port