Added States for file operations and diagnostics.

Mostly added states. Also may have finally found array overrun bug
causing crashes.
misc

added functionality