pattern matching + tuples

+ added some comments