Simplify the way shared resources are managed.

Moving towards #278.