try to refactor the functions. Dump effort.