implement caching to localStorage closes #2