added some more documentation, it needs work though to make the LaTeX output correct