Minor changes in algorithms