Make onMode event easier to parse

Change modes string and parameters array in onMode to a list of KeyValuePairs (mode and its corresponding parameter).