added dynamic pedestal and common mode subtraction