restructured rt_box.c