added: fitting before S2 calculation