Converted listeners to object instead of array, so that listeners can be removed (in a future commit).