Declared date variable inside function. Needs to be minimized.