Added a few minor fixes and more comments