refactoring and calendar class