refactor stages package