Added some in-line comments and adjusted various whitespacing.