add more tests and pep8 improvements