Moved more stuff into classes. Enhancements to file cache and fixed incorrect xcache functions.