modify function to extract endpoint survival