Final checks, fixes and pep8 cleanup