Added sorting to Dictionary
Minor refactor in Dictinary