adding destroy function