minor fixes, added more comments