Another try with (immutable) TreeMaps.