how modes are formed in waveguide