Added tests and resolved some pep8 problems