Clean up some code per @baweaver's suggestions.