Added code for part b