Tidied up the calendar generation