Fixed minor issues and pep8 errors