internal refactors to use typekey