I am not clear as to how the removal of transactions from the non-confirmed pool happens. I have not found any descriptions explaining how the process works.
Here are the scenarios as I see them:
A) When a node selects a set of transactions to be included in a possible block it removes them from the non-confirmed pool. So if/when the node solves the block there is no clean up necessary of the not-confirmed pool.
B) Transactions may be included in multiple potential blocks and remain in the not-confirmed pool while blocks are being solved, then when a block is solved the transactions included in the block are removed from the not-confirmed pool. This sounds to me as the most likely scenario but it is not clear at all who/when removes the transactions from the not-confirmed pool.