renamed variables approprietly in s