Converted to use Modules feature.

Also replaced Mutex with RWMutex, added error logging for datastore.Put.