revert refactor code and add test cases of token