move the decoding out