Refactoring: doc class

Converting the `doc` class from using `S4` to `ReferenceClasses`.