removed unsed $valid