Use auto cleanup and clear functions where possible
@exalm would you mind giving it a look? It's easy to mess up this kind of refactoring.
Edited by Adrien Plazas
@exalm would you mind giving it a look? It's easy to mess up this kind of refactoring.