cleaning a bit the code