sorted keys and better lazy evaluation