Replace case statement with hash table lookup