Destroy things properly, fixes memory leak