refactoring: detector and types now outside (in run)