Implemented the second algorithm