Code for dictionary to make the tests cases pass. Refactor pending