move pattern processor into separate file