Adjusted dtype for python 3. Various pep8 adjustments.