added code for generating h for the channel