refactor table mirroring