Rebase sg

It'd be nice to have the comments in a sphinx-compatible version, thus having automated docs for it.