Extract som variables for clarity.
Protect datastorage with a mutex.
Added destructor.
Added a note to remind me of checking for available disk space.