refactor dict