refactoring and documentation in comments file functions