Proper cleanup of per connection resources. Consider replacing with reference counted object instead of per function object if time permits.