Plugin channel names now constants, compacted code using Autocloseable, using Math.min/max instead of explicit comparisons.