fixed documentation typo and improved encapsulation