Refactored decode -> decode_ex