Updating for python3 compatibility