Pull in factory refactor and some clean up