More work on KMP search - shameless cribbing form the Scala source code!