edit function working