various modifications
work ongoing for unfolding code
work on unfolding