improved code for Majority