add average and binarize
make condition and invert a function