major performance improvement to get_targets