Added comments. Fixed segfault.