Merge meta's changes

These are the commits from https://github.com/Metastruct/pac3 excluding the ones related to mdl_import, vfs, and the disclaimer. (Cherry picked, with conflicts resolved and re-committed manually).

If you accept this PR I plan on rebasing the Metastruct branch on this and then using branches properly over there so that we don't run into merge hell again...