more pretty code in pattern matching