Split token decoding out into own function