refine the algorithm according to wal-mart's data