implemented caching;
some style cop warnings corrected