added comments on the mode algorithm