updated code for calendar