added typehints everywhere