Simplified by using the exists function.