some code improves and pep8