a lot of refactorings regarding type and id