Use nested hashes for message lookup