updated regex and minor fixes