prune and organize packages