more code to deal with dates