Reworked the mode function to accommodate multi/bi modal values