Refactoring, fix regular expressions.