rewritten completion type detector