Clean up the partial generic sharing code a bit.