federation refactor