Finish edit function