Added pattern matching