More comments and fix undefined variables.