* refactor error handling through common transaction() method * maintain consistent index file on disk in the face of errors * implement locking for multithreaded use