Comments added. Refactoring.