I see your point.  What if you just moved the removeStage function call to be at line 356 -- that way you have the readability benefits of inlining it (my original comment stemmed from my confusion when I didn't see why you weren't cleaning up the entry stageIdToJobIds there) but the flexibility to easily separate the two calls in the future, if necessary?