refactored according to Joshua's comments in https://tickets.opscode.com/browse/COOK-2696