Jun, look into using namespace variables to pass around data strucutres instead of upvar. I should start a thread on this.