cleaning up the calendar generation to use returns instead of globals/pass by ref