no need use temp array anymore