Correct work on majority function