implement edit mode