added timestamp out of if control