Modified assignments to use a map instead of a vector for fast lookup.