optimization: caching resource types in get_resourcetype.
eliminate some it_find calls.
eliminate static variables, they make testing hard.