refactored TimeDatabase to use TimeContract