Updated patch attached, incorporating your comments.