mcgb.lib: rebuild the algorithm due to the paper draft