Simplify mode function.