refactor comment logic