added rudimentary multi-channel support (in calc_shifts)