bugfixing and refactoring of timestamps