The code might be organized in a hierarchy, but the solution has more dimensions than will fit in a hierarchy. So when you discover a solution in a dimension that crosses across the hierarchy, you just have to go where the solution takes you and put the solution in.
A Conversation with Ward Cunningham (2003) - Collective Ownership of Code and Text