Improved issue #12 with a simple caching mechanism.