Replace Pattern implementation with sorted lists (from maps)