some cleanup
fixed main. defer channel closing