Updated for python3