Refactored addItemsToImport' code. Also added possible tests.

Much of this changes to TypeUtils were to clean up not only addItemsToImport' code, but also remove much of the old addItemsToImport code lying around.