Finish editing function