start change first stage. Code migrate from mgra.cpp to stage1.cpp