some refactoring. specing out patterns
some refactoring. specing out patterns