New demo code with the validity display