move pattern to new class