Refactoring and documentation of the code.