updated unfolding macro and parameterized matrix unfolding header