Fixed section (a) and removed redundant code.