add documentation, fix pep8 style.