Witlessbird's fix to reduce database lookups and do Ruby hash lookups instead