Added comments and made minor reorganizations.