added state sanitizing