Move tests to proper file.
Clean up docstrings a bit.
Much cleanup.