Basic pattern matching
Simplify pattern matching and make it more elegant