corrected minor typos and added comments