Further abstraction, improved docstrings