Rejiggered everything to make it work with the new build system