fixed question 2(a) thanks to Joseph Hui