Refactoring to remove cycles.