reform code, ad remove all print_r()