fix regex
some refactoring
fix regex