Refactoring and comments