Improve with Pattern Matching