small refactoring and comments.