Fixed some syntax, renamed some variables, and added to the inline documentation.