starting persistence layer...

Starting the persistence layer, and general refactoring of exported
interfaces.