refactoring on string and dates