Code review for commit 1c3b6fe1d6a54b2cd3d4ac6887ed1a673dcb015e. Fixes #198