could we combine this logic with the logic above?