nicer code, caching, and some history fixes
Merge pull request #5 from sinapsa/eyal

nicer code, caching, and some history fixes