Move collapseTree into its own module so backside-client can require just that function.