Created validate outside function