mode function added