added proper timestamp handling