Refactoring: doc class

I have converted the `doc` class from using `S4` to `ReferenceClasses`.