Code formatting and pep8 fixes