Proposed patch attached, please review.