Added unit tests, and added the writeln and clear methods. Updated
docstrings.