updated deletion function and test