working with comments and minor changes for optimizing caching