Implement changes discussed for pull request (this commit will be squased before merge, I guess).