moved timestamp to own function