Added edit function with bug