This and the above functions should all be right before Decoding.