Updated for python 3