modified fold state code