added mode and median functions