Modified pauedo_code in match