[DEBT] - refactor duplicated code.
[DOC] - added comments.