Added comments throughout.