some minor speedups using caches and more selective updating