Added more comments.
Minor code cleanup.
Minor code cleanup, made code more DRY compliant.