tidied up some of the date functions