step 1. move pattern matching to transform.patmat
step 2. split patmat in smaller files