made c++ classes for event handler and channels. cleaned up code.