refactoring and comments.