Updated for python version 3