Added some comments, fixed typos