TTree: refactored rl encode/decode routines