Addresses most of the comments on the PR.