Handling edit and delete