Added cache to memory and combined with Jeff's changes
more from earlier