added the "wire is changed" function