Regex tweak and some minor fixes