Fixed up comments; fixed potential memory leaks by passing values instead of pointers