Updated validation logic