Use database lookup instead of hashtable