refactoring get_targets