Updated validate script, now works correctly