fixed #754 and serious callendar refactoring