added output of match and changed order of variables