some minor comment and refactoring