change WAD algorithm