refactor dict generator