made destroy function