Updated code to match 2.67 version

Updated code to match 2.67 version and pep8 compliance of changes. TODO: 2.68.2 update.