Patch by David Kilzer, reviewed by Darin.