add multi-stage support