change the mode function