updated edit function in models