Refactor to use channels instead of locks.