modify to switch positions of Pattern matcher and Pattern matching environement