Revert "Remove obsolete hacks"

This reverts commit b3e793f0860286669c4be2934a1e71c6fb717d2c.
Revert "Move abstract classes out of Formula directory"

This reverts commit c56eeff11f80bfe6d919558c2eec50832d1d2bb4.