update code for narrow resonnance