Added intermediate cache folder in regards to reducing cache fanout.

Ran code through all unit tests and fixed any bugs found.  Also updated cmd line client to use non-deprecated functions