I think this frees all the memory, properly but I could be wrong...