added a lot of documentation.