function refactoring & PEP8 improving