add done channal flag, keep waiting for the go loop func

closes #37