Added step-by-step decoding algorithm