Corrected the order of the execution of the stages.