Extending the effective index method for arbitrarily shaped inhomogeneous optical waveguides