Added more tests and some minor refactor to make timestamp more consistent