some cleanup of vars to conserve mem, more comments