Big update: fix typos, add comments, update code