adding recomputeMode function to manually recompute the modes.