Some code cleaning prior. Hopefully final version