updted the destroy function to actually work