adds delete function, onclick check for delete