Multilevel buffer rebased on development

OK so here is the pull request from the multilevel buffer branch after a rebase on development branch with all conflicts resolved from the multiperiod changes.