Refactor message loop to use less channels and go routines