stronger regex and code-style change