cleanup loop a bit