A slight reorganization of code