Bringing 4.12 changes into theories subtree.

Should satisfy #20.