fixed typos, added some comments