refactor: use self-defined function
some refactor