refactoring - move root stuff here