Adding comments, and fixing a few issues