Move timestamp to function