Can we extract this check out as a method so that we have a better idea as to what it's doing?