a few refactoring