Unreverted DEP-007 merge

This reverts commit 361a8e82380e9e466eaa71d20a0a0a5fa9cffbda,
which is a revert of merge 28e4204e4e7fb678d91a6f92c9abe6c5d7b7c251.

The changes have been backed out to solve bootstrap issues.