Fix for python 3.2 issue and cosmetic changes