Fixed threading and cache bugs. Added internal error handling. Added … …several command line options to control thread use, cache use.