begin tool refactoring