Can we move this to its own method? We repeat this logic on L175.