split and moved the logic of the local/distant mapping in the resource.