Revert "Clean up and reorganize all the build optimizations"

This reverts commit 66590a6af94dc2ba7641af2ba43a65e93b2e85ea.