add script to wrap hierarchical code.

+removed old implementation