reordering some code.