Minor restructure and more source build fixes