Python 2.7 compliant change; syntax improvements