factored out resolveHandles