Function validateStroke