Improved encapsulation and adjusted docstrings.