Instead of having the comment, could you please move this code block to a well-named, well-documented function?