Added KMP matching and other methods