Improved delete functionality