refactoring for public