Refactoring, adding code documentation.