fixed a compilation bug, added a few comments