And I'd move this to a separate function for reusability and better readability.