Garbage collecting functions

This community tutorial may help out: