add documentation to the rest of the code as well and cleanup

2 jobs for master in 1 minute and 49 seconds (queued for 1 second)