Refactor into identitytable and add normal table abstraction