Got double calculation of S's working.