Added some documentation

And a few random functions as well.