Re-rolled patch #40.
Please review.