Solved in-class exercise