Clearing up a bit the code