Refactored datetime-stuff