moved now_timestamp within function