I've broken things up to make it easier to review but in order to avoid regressions with ARB asm style programs I believe I need to squash the follow sets of patches before pushing. 2,3,4,5 and 10,11