Added pregel stop function