Make BuildStage much more generic