decoding using types