I think that the logic in this if-statement should be combined with the earlier conditional with the same conditions.