Make supplying datastore dir more consistent.  Other refactorings