internal code cleanup: use dictionaries instead of arrays