tweaked grep to be more flexible of how the key was added