Move scope check back into the listener. Refactored length check out of extract query. Use length to generate actual replacement for both ocp-index and locals. Fixes #7.