rewritten all functions by the criteria of pep8