use anonymous function instead of nextStage