wip: Some more work on new build system
wip: Re-arranged the code a bit