A little refactoring and more tests
Refactor the month/year determination
Common logic moved into Util module
Comments added for clarity