Replaced Mode calculation function with one with continuous-domain support.