finally got mean and median working