refacorted stages to include an id