performance enhancement: using ints instead of strings as keys in dicts