implemented pattern match on pairs (Lecture 5.2)