minor reordering and TODO