Refactoring and more comments.