changing algorithm
algorithm bug