seems like everything you use this function, you'll need to call removeStage.  Can you just factor removeStage to be part of this function?