fix error and factorize code, modify style token_input