calendar end stuff and flag stuff