Made the amount of channels configurable and fixed the averaging in the main channel.