comments and refactor