more refactoring and comply wih pep8 spec