added simple pattern matching