Rewrote generateMonthHeader in more idiomatic function style