Reorganization of some code.