refactoring to include the root