Build system changes

Bunch of changes to the build system.