Revert "Clean up and reorganize all the build optimizations"

This reverts commit 587d8d10dc371626e5422c2d9882b4f974910d5a.