add a few comments, take out logger, ref to error_counter