finished changes from mean to median