removed stages boolean flags; now keep track of dependencies between
stages using postStages