Switch to perfect hashing for lookups, to save space