Added more pattern matching code