That code doesn't work with RTAB, because phase 2 in the RTAB script does a few other things. I'm using a variant of RTAB, and I eventually plan to do this same thing. If someone doesn't answer your question before I get to doing that, I'll let you know how I accomplished it.