Implement edit function.