Use dicts for index lookup for improved performance