Need to add global declarations for channel communication. Fixed a bug in channel communication