Refactored again and changed date output format