added cleanup method for states