Project Issue #1095 #804 #982. XCache bugfixes and code cleanups.