fixed a few bugs
changed comments