New build system, misc refactoring.