[#642] Refactored datastore config to make it easier to understand and easier to test