Clean a bit the code, add some comment