Improve and test dictionary codegen.