applied improvements for comments and refactoring