Factored. Now runs an optional callback and root is set elsewhere.