Add tests and improve a little pep8-iness.