refactoring and commenting