Tidied up dictionary generator.