Rewrite Dictionary class.

This commit rewrites `Dictionary` class into something more C++-like
and less of an hack.
Merge pull request #56 from peelonet/dictionary-rewrite

Rewrite Dictionary class.