WIP: New MLE framework

This branch is implementing #110.

Not finished yet, but in steady progress.