Added support for marking and clearing invalid state