Added more comments. I have no idea how to generate documentation though