Added a few comments, fixed a segfault