Use array lookup instead of pattern matching