updated unfolding script