Compute percent of cell by using threshold
minor improve and some other stuff