refactored root method