updated the algo for signature decoding