Code refactoring

Integration of the greater part of the comments