refactoring scan match pattern and applied sequencial operations