Revisited the exercise and made some changes