some comment and refactor