even more mnesia pulled out and abstracted into it's own module.  history optimzer is left