restructure for dub and a few other fixes