tweaked to simplify arguments, and shifted stereo calculation