improved destroy button functionality