Changed implementation to work with dict.