Using object instead of array for messages