Fix comment and refactor func