localoptimizations from the global_array_names branch grabbed. still need to match the index and limit for identical checks