remove many redundant staff for faster performance and memory reduction
reduce some computations for output labels
remove one more strdup