Refactor to fix component dependencies.