refactor hierarchy