On a related point, can/should we make RegTsx into a class and move some of this function into it?