Cleaned up implementation of #48. We have proper java objects instead of ad-hoc HashMaps.
Merge pull request #72 from jfly/master

Cleaned up implementation of #48.