Adding delete function and unit tests