integrated correctly calendar logic