modify dgs example with a nextStep loop