Changed the code generation code back to calculating each and every day.