update code for stage 2 in epclust