comitting algorithm2