implementing PatternPointer for quicker computation