Add functions to organize the [key,value] pair and modify some bugs