Fixing tests failing and pep8