added culling of all but necessary branches