Added code documentation
Refactoring