Reworking and cleaning up into states