Fixed multithreading, added real caching to disk.