This would be cleaner inside the if block. There's no need to update the set if there is no underlay packages.