Adding prune function, and integrating scripts