added resource caching and improved doc