use select statments when writting to channels in a for loop.