Added a lot of documentation.