Added comments function and refactoring