refactoring on new pattern