Updated code with edit and delete functions included