Merge changes from master branch, apply updates for python 3.