input, decoding and output