improved delete fucntionality