updated the functionality for editing and deleting