Re-introduced the 'remove only leaf-objects restriction', when it is not needed anymore, rolled back changes on this specific code block