Reorganize a bit the code