implement edit function. Not yet finished