Initial Sphinx documentation and minor fixes