refactoring

divide function and be private