update some function.
add some functions, changes some structures.