added solution for mode