Separated some functions which generate token