added comments, fixed spelling errors, changed some printf's