Refactor and comment.