cell clearing algorithm done