Develop pull request from meng

Add several common function for calculation; revise the common method that I get rid of the data set modification handling and just return the generated value directly.