Thanks for the suggestions! I've attached a revised patch with the suggested changes.