simplified mean function and finished task 4.6