added comments, fixed typos