Move payload into separate function