Tidy up and added some logging to datastore classes