Did a method for Q2 of exercise7