some refactoring to fix comments