Refactor timestemp formatting