Back end for the calendar (almost complete)