Edited edit function.