Working version. TODO: refactoring CurrentMainDistStage and init time stamp