Refactoring, adding comments