Improved with pattern matching