fixed messy type hinting for more comprehensible structure