use global var rather vector to store intermediet result