Use more elegant dict lookup.