minor refactoring and correcting the comments