Improved documentation.
General functions moved outside of the class.