context and userId support, make regexes slightly more efficient, deep merge metadata