Refactored into a form that reads better to me