Better scoped ids on tables and copy refinement