Final version with some code cleaning