added code to look at other flag files to decide whether to regenerate.
stuff
adding some logging
invalid is out of date logic
one minor fix to message log