refactoring of year and month class