reworked typing functions