Reorganized code for the next changes