range over channel instead of a naked for loop