Modes in inhomogeneous slab waveguides