Refactored RootController for reusability